home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / pcspeed.zip / PCSPEED.C next >
Text File  |  1993-05-16  |  2KB  |  106 lines

  1.  
  2. /*  Adapted from Benchmarking The Speedy PCs In C */
  3. /*  Micro Cornucopia, #29, April-May 1986 by      */
  4. /*  Gary Entsminger.                              */
  5. /*  Three benchmarks were grouped into one with   */
  6. /*  self-timing added.  Descriptive comments and  */
  7. /*  the changes by Neal - Sunnyvale,CA Feb '87    */
  8. /*  Compiled with DeSmet C - ver 2.51             */
  9.  
  10. main()
  11. {
  12. int i,j,k,l,stime,ntime,dotime,seconds;
  13. int seconds1,seconds2,seconds3;
  14. scr_setup();
  15. scr_clr();
  16.  
  17.  
  18. printf("\n PCSPEED VER: 1.1 - Complied with DeSmet C - ver 2.51.\n\n");
  19. printf("Adapted from Benchmarking The Speedy PCs In C\n");
  20. printf("Micro Cornucopia, #29, April-May 1986 \n");    
  21. printf("by Gary Entsminger.\n\n");
  22.  
  23. printf("Three benchmarks were grouped into one with\n");
  24. printf("self-timing added.  Descriptive comments and\n");
  25. printf("the changes by L.B Neal - Sunnyvale,CA Feb '87.\n");
  26. printf("Timing function by Tom Serface - Ticks.A.\n\n");
  27.  
  28. printf("The following three benchmarks are processor\n");
  29. printf("intensive.  #3 is more of a test of screen\n");
  30. printf("writing efficiency.\n\n");
  31.  
  32. {
  33. /* TEST #1 */
  34.  
  35. i=0; j=1; k=2; l=0;
  36.  
  37.  
  38.  stime = ticks();
  39.  
  40.   for(l = 0; l < 20; ++l)
  41.    {
  42.      for(i = 0; i < 20000;++i)
  43.       {
  44.         k =((j+1))/j+i;
  45.         if ((i % 1000)==0)
  46.           {
  47.            if(l < 19) putchar('1');
  48.            else putchar('x');
  49.           }
  50.       }
  51.    }
  52. printf("\n%d j  %d k  %d i\n\n",j,k,i);
  53.  
  54. ntime = ticks();
  55. dotime = ntime - stime;
  56. seconds1 = (dotime * 10) / 182;
  57.  
  58. }
  59.  
  60. {
  61. /* TEST #2 */
  62. i=0; l=0; stime=ticks();
  63.  
  64.   for (l = 0; l < 20; ++l)
  65.    {
  66.     for(i = 0; i < 20000;++i)
  67.      {
  68.        if((i % 1000)==0)
  69.         {
  70.          if(l < 19) putchar('2');
  71.          else putchar('x');
  72.         }
  73.      }
  74.    }
  75. printf("\n%d i\n\n",i);
  76. ntime = ticks();
  77. dotime = ntime - stime;
  78. seconds2 = (dotime * 10) / 182;
  79.  
  80. }
  81.  
  82. {
  83. /*  TEST #3 */
  84.  
  85. i=0; stime=ticks();
  86.  
  87.    for(i = 0; i < 20000;++i)
  88.     {
  89.       putchar('3');
  90.     }
  91. printf("\n%d i\n",i);
  92. ntime = ticks();
  93. dotime = ntime - stime;
  94. seconds3 = (dotime * 10) / 182;
  95.  
  96.  
  97. printf("\n Test #1 took %d seconds.",seconds1);
  98. printf(" IBM XT takes ~51 seconds.\n");
  99. printf("\n Test #2 took %d seconds.",seconds2);
  100. printf(" IBM XT takes ~28 seconds.\n");
  101. printf("\n Test #3 took %d seconds.",seconds3);
  102. printf(" IBM XT takes ~46 seconds.\n");
  103.  
  104. }
  105. }
  106.